<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>运算符</title>
</head>

<body>
    <script>
        //需求:要求用户输入一个整数，判断这个数是否在100~200之间的数
        /* let num = prompt('请输入一个整数');
        (num >= 100 && num <= 200)
            ? alert("是范围内")
            : alert("不在范围内"); */

        /* let a = 12;
        let b = 13;
        let max = a > b ? a : b;
        console.log(max);//13 */

        /* let a = 10,
            b = 5;
        a = a + b//15 5
        b = a - b//10
        a = a - b;//5
        console.log(a, b); */


        var a = 1,//0001
            b = 2;//0010
        /*  a = a ^ b;//a=0010,b=0010
        b = a ^ b;//a=0011,b=0001
        a = a ^ b;//a=0010,b=0001 */

        /* a ^= b;
        b = a ^ b;
        a ^= b;//简写，结果一样 */

        //宿主特性
        /* a = [a, b];
        b = a[0];
        a = a[1]; */
        //简写方式
        a = [b, (b = a)][0];
        console.log(a, b);//2,1

    </script>
</body>

</html>